<?php
class controller_theme extends controller
{

	public function __construct()
	{

		$my = bone::get_user();

		if($my->guest || !isset($my->is_admin) || $my->is_admin!=1 )
		{
			$controller = get('controller');
			$task = get('task');
			if( $controller!='user' || ($task!='login' && $task!='ajax_login_check'))
			{
				if(substr($task, 0, 4)=='ajax_')
				{
					$this->set_ajax('status', 1);
					$this->set_ajax('description', '��½��ʱ�� �����µ�½');
					$this->ajax();
				}
				else
					$this->redirect('./?controller=user&task=login');
			}
		}

		$config = bone::get_config('system');
		$this->set_data('site_name', $config->site_name);

		$menu_id = get('menu_id', 0, 'int');
		$main_menu = bone::get_menu('main', APP_DIR);
		$this->set_data('main_menu', $main_menu->get_menu_tree());
		$this->set_data('main_menu_pathway', $main_menu->get_pathway($menu_id));

		parent::__construct();
	}

}
?>